package cn.iocoder.yudao.module.scrm.controller.admin.receivable.vo;

import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import cn.iocoder.yudao.module.scrm.annotations.DictField;
import cn.iocoder.yudao.module.scrm.controller.admin.commom.vo.FileInfoVO;
import cn.iocoder.yudao.module.scrm.enums.DictTypeConstants;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
import static cn.iocoder.yudao.module.scrm.enums.DictTypeConstants.SCRM_AUDIT_STATUS;
import static cn.iocoder.yudao.module.scrm.enums.DictTypeConstants.SCRM_PAYMENT_METHOD;

@Schema(description = "管理后台 - 回款 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ReceivableRespVO implements Serializable {

    private static final long serialVersionUID = 997101783405061369L;

    @Schema(description = "ID")
    //@ExcelProperty("主键ID")
    private Long id;

    @Schema(description = "回款编号")
    @ExcelProperty("订单编号")
    private String no;

    @Schema(description = "回款日期")
    @ExcelProperty("回款日期")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY, timezone = TIME_ZONE_DEFAULT)
    private LocalDate returnTime;

    @Schema(description = "回款方式,关联枚举CrmReceivableReturnTypeEnum", example = "1")
    @DictField(dictType = SCRM_PAYMENT_METHOD)
    @ExcelProperty(value = "回款方式" , converter = DictConvert.class)
    @DictFormat(SCRM_PAYMENT_METHOD)
    private String returnType;

    private String returnTypeLabel;

    @Schema(description = "计划回款金额", example = "6971")
    @ExcelProperty("计划回款金额")
    private BigDecimal price;

    @Schema(description = "审批状态", example = "1")
    @ExcelProperty(value = "审批状态" , converter = DictConvert.class)
    @DictFormat(SCRM_AUDIT_STATUS)
    private Integer auditStatus;

    @Schema(description = "负责人名称", example = "杨")
    @ExcelProperty("负责人")
    private String ownerUserName;

    @Schema(description = "负责人部门")
    @ExcelProperty("负责人部门")
    private String ownerUserDeptName;

    @Schema(description = "创建人姓名id")
    private Long creator;

    @Schema(description = "创建人姓名")
    @ExcelProperty("创建人姓名")
    private String creatorName;

    @Schema(description = "创建时间")
    @ExcelProperty("创建时间")
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
    private LocalDateTime createTime;

    @Schema(description = "更新时间")
    @ExcelProperty("更新时间")
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
    private LocalDateTime updateTime;



    @Schema(description = "客户名称", example = "杨")
    @ExcelProperty("关联客户名称")
    private String customerName;

    @Schema(description = "备注信息", example = "随便")
    @ExcelProperty("备注信息")
    //@ColumnWidth( 30)
    //@ColumnWidth(name = "remark", length = 10)
    private String remark;







    @Schema(description = "订单号", example = "2138")
    //@ExcelProperty("订单号")
    private Integer orderId;

    @Schema(description = "订单标题", example = "2138")
    @ExcelProperty("订单标题")
    private String orderTitle;

    @Schema(description = "回款计划编号", example = "31443")
    //@ExcelProperty("回款计划编号")
    private Long planId;

    @Schema(description = "客户编号", example = "26225")
    //@ExcelProperty("客户编号")
    private Long customerId;



    @Schema(description = "合同编号", example = "14733")
    //@ExcelProperty("合同编号")
    private Long contractId;

    @Schema(description = "负责人编号", example = "18541")
    //@ExcelProperty("负责人编号")
    private Long ownerUserId;






    @Schema(description = "附件信息")
    //@ExcelProperty("附件信息")
    private List<FileInfoVO> attachment;

    @Schema(description = "图片-附件信息", example = "https://www.iocoder.cn")
    private List<FileInfoVO> pictureAttachment;


    @Schema(description = "工作流编号", example = "26468")
    //@ExcelProperty("工作流编号")
    private Long processInstanceId;






}